package com.leigang.swagger.controller;

import com.alibaba.fastjson.JSONObject;
import com.leigang.swagger.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    IUserService userService;

    @GetMapping("/list")
    public String list(){
        List<Map> userList = userService.getUserList();
        return userList.toString();
    }


    @GetMapping("/lists")
    public String lists(){
        List<Map> userList = userService.getUserLists();
        return userList.toString();
    }


    @PostMapping("/list1")
    public String list1(@RequestBody JSONObject params){
        log.info("request param:{}", params);
        List<Map> userList = userService.getUserLists();
        return userList.toString();
    }

    @GetMapping("/index")
    public String index(){
        return "欢迎来到我这儿";
    }

}
